import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("member_pkey", ["id"], { unique: true })
@Entity("member", { schema: "public" })
export class Member {
  @PrimaryGeneratedColumn({ type: "integer", name: "id" })
  id: number;

  @Column("character varying", {
    name: "account",
    length: 30,
    default: () => "''",
  })
  account: string;

  @Column("character", { name: "password", length: 64, default: () => "''" })
  password: string;

  @Column("character", { name: "salt", length: 12, default: () => "''" })
  salt: string;

  @Column("smallint", { name: "belong", default: () => "0" })
  belong: number;

  @Column("integer", { name: "creator_id", default: () => "0" })
  creatorId: number;

  @Column("integer", { name: "tenant_id", default: () => "0" })
  tenantId: number;

  @Column("int4", { name: "leaders", nullable: true, array: true })
  leaders: number[] | null;

  @Column("integer", { name: "direct_leader", default: () => "0" })
  directLeader: number;

  @Column("int4", { name: "depts", nullable: true, array: true })
  depts: number[] | null;

  @Column("integer", { name: "direct_dept", default: () => "0" })
  directDept: number;

  @Column("character varying", {
    name: "name",
    length: 30,
    default: () => "''",
  })
  name: string;

  @Column("character varying", { name: "tel", length: 11, default: () => "''" })
  tel: string;

  @Column("boolean", { name: "super", default: () => "false" })
  super: boolean;

  @Column("int4", { name: "roles", nullable: true, array: true })
  roles: number[] | null;

  @Column("character varying", {
    name: "email",
    length: 100,
    default: () => "''",
  })
  email: string;

  @Column("boolean", { name: "enable", default: () => "false" })
  enable: boolean;

  @Column("character varying", {
    name: "remark",
    length: 100,
    default: () => "''",
  })
  remark: string;

  @Column("integer", { name: "register_time", default: () => "0" })
  registerTime: number;

  @Column("integer", { name: "last_login_time", default: () => "0" })
  lastLoginTime: number;

  @Column("cidr", { name: "last_ip", nullable: true })
  lastIp: string | null;
}
